/*
* Copyright (c) 2011 Norbert Kopcsek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.modulr.bundle {

	/**
	 * Customizes the starting and stopping of this bundle.
	 *
	 * IBundleActivator is an interface that may be implemented when this bundle is started or stopped.
	 * The Framework can create instances of this bundle's IBundleActivator as required.
	 * If an instance's IBundleActivator.start method executes successfully, it is guaranteed that
	 * the same instance's IBundleActivator.stop method will be called when this bundle is to be stopped.
	 *
	 * IBundleActivator is specified through the bundleActivator attribute in the bundles.xml.
	 *
	 *
	 * The specified IBundleActivator class must have a public constructor that takes no parameters so
	 * that a IBundleActivator object can instantiated by the framework.
	 *
	 * @author Norbert Kopcsek
	 */
    // TODO Update! There are more ways a IBundleActivator can be defined!
	public interface IBundleActivator {
		/**
		 * Called when this bundle is started so the Framework can perform the bundle-specific activities necessary to start this bundle.
		 * This method can be used to register services or to allocate any resources that this bundle needs.
		 * This method must complete and return to its caller in a timely manner.
		 *
		 * @param context The execution context of the bundle being started.
		 */
		function start( context:IBundleContext ):void;

		/**
		 * Called when this bundle is stopped so the Framework can perform the bundle-specific activities necessary to stop the bundle.
		 * In general, this method should undo the work that the IBundleActivator.start method started.
		 * A stopped bundle should be stopped and should not call any Framework objects.
		 *
		 * @param context The execution context of the bundle being stopped.
		 */
		function stop( context:IBundleContext ):void;
	}
}